#include <stdint.h>
uint16_t uiphtons(uint16_t n)
{
    uint16_t temp = 0x0;
    uint8_t *pn = (uint8_t *)&temp;

    *(pn+0) = (uint8_t)(n>>8);
    *(pn+1) = (uint8_t)(n>>0);

    return temp;
}
uint16_t uipntohs(uint16_t n)
{
    uint8_t *pn = (uint8_t *)&n;
    uint16_t temp0, temp1;

    temp0 =  (uint16_t)(*(pn+0));
    temp1 =  (uint16_t)(*(pn+1));

    return (temp0<<8 & 0xff00) | ( temp1 & 0x00ff);
}

uint32_t uiphtonl(uint32_t n)
{
    uint32_t temp = 0x0;
    uint8_t *pn = (uint8_t *)&temp;

    *(pn+0) = (uint8_t)(n>>24);
    *(pn+1) = (uint8_t)(n>>16);
    *(pn+2) = (uint8_t)(n>>8);
    *(pn+3) = (uint8_t)(n>>0);

    return temp;
}

uint32_t uipntohl(uint32_t n)
{
    uint8_t *pn = (uint8_t *)&n;
    uint32_t temp0, temp1, temp2, temp3;

    temp0 =  (uint32_t)(*(pn+0));
    temp1 =  (uint32_t)(*(pn+1));
    temp2 =  (uint32_t)(*(pn+2));
    temp3 =  (uint32_t)(*(pn+3));

    return (temp0<<24 & 0xff000000) | ( temp1<<16 & 0x00ff0000) | ( temp1<<8 & 0x0000ff00) | ( temp1 & 0x000000ff);
}


